package com.purdue.edu.psychotron.client.service;

import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.purdue.edu.psychotron.shared.Pair;
import com.purdue.edu.psychotron.shared.Quad;
import com.purdue.edu.psychotron.shared.UUID;

@RemoteServiceRelativePath("user")
public interface UserService extends RemoteService {

	// Server will return feedbacks
	String register(String firstName, String lastName, String login, String password);

	// Server will return feedbacks
	String logIn(String login, String password);

	// Server will return feedbacks
	String logOut(String login);

	// Server will return feedbacks
	String unsubscribe(String login);

	// This service automatically assume that the user wishes to use the Cloud Messenger Feature. 
	// So it will automatically create an contact book for this user should it has never been set up
	ArrayList<Pair<String, String>> getContactPairListByUerId(String userId);

	ArrayList<Pair<String, String>> getBlockedContactPairListByUerId(String userId);

	// This will also create a ChattingHistory Entity if necessary
	String addNewContactByUserId(String baseUserId, String targetUserLogin);

	//This function involves an implicit creation of a new MessageBuffer Entity if necessary
	void sendMessageToBuffer(String userAId, String userBId, String message);

	//This function involves an implicit creation of a new MessageBuffer Entity if necessary
	String requestMessage(String userAId, String userBId);

	void timmer(Integer waitForNSeconds);

	String getUserLoginByUserId(String userId);

	String getUserFullNameByUserId(String userId);



	void initializeCloudMessengerForUserId(String userId);

	// This will set the requester's status to UNAVAILABLE and destroy the messageBuffer
	void disengageCloudMessengerForUserId(String userId, String targetUserId);

	void removeContactByUserId(String requesterId, String targetUserId);

	ArrayList<String> getContactListByUserId(String userId);

	ArrayList<String> getContactNameListByUserId(String userId);

	ArrayList<String> getBlockedContactListByUserId(String userId);

	ArrayList<String> getBlockedContactNameListByUserId(String userId);
	
	// Quad<userId, userLogin, FullName, Status>
	ArrayList<Quad<String, String, String, String>> getContactInfoBundleListByUserId(String userId);
	
	// Quad<userId, userLogin, FullName, Status>
	ArrayList<Quad<String, String, String, String>> getBlockedContactInfoBundleListByUserId(String userId);
	
	// Quad<userId, userLogin, FullName, Status>
	ArrayList<Quad<String, String, String, String>> getPendingContactInfoBundleListByUserId(String userId);
	
	void blockContactForRequesterIdByTargetId(String requesterId, String targetId);

	String getChattingHistoryByIds(String userAId, String userBId);

	void clearChattingHistoryByIds(String userAId, String userBId);
	
	void inviteContactByTargetLogin(String userId, String targetLogin);
	
	void acceptContactByTargetLogin(String userId, String targetId);
	
	void rejectContactByTargetLogin(String userId, String targetId);
	
	
}